import React, { Component } from 'react';
class View extends Component {
    constructor(props){
        super(props);
        this.state = {
            isGoing:false,
            chck:[
              {checked:false,title:'选择一'},
              {checked:false,title:'选择二'},
              {checked:false,title:'选择三'},
          ]
        }
    }
    onMouseEnter(e,key){
        const chck = this.state.chck;
        for(let i=0,len=chck.length;i<len;i++){
            chck[i].checked = false;
        }
        chck[key].checked = true;
        this.setState({
            chck:chck
        });
    }
    render(){
        return (
            <div>
                {
                    this.state.chck.map((val,key)=>(
                        <label className={this.state.chck[key].checked? 'aaa':''} onMouseEnter={(e)=>this.onMouseEnter(e,key)} key={key}>{val.title}
                        </label>
                    ))}
            </div>
        )
    }
}
export default View;
